package main

import "fmt"

type Stu struct {
	Name string `json:"name"`
	Age  int    `json:"age"`
	like string
}

// 值传递
func (stu Stu) study() {
	fmt.Println(stu.Name, "在认真学习")
	stu.Name = "小红"
	fmt.Printf("值传递：%p\n", &stu)
}

// 引用传递
func (stu *Stu) study2() {
	fmt.Println(stu.Name, "在认真学习")
	stu.Name = "小红"
	fmt.Printf("引用传递：%p\n", stu)
}
func main() {

	stu := Stu{
		Name: "小明",
		Age:  29,
		like: "写代码",
	}

	fmt.Printf("stu地址1：%p\n", &stu)
	stu.study()

	fmt.Println(stu.Name)

	stu.study2()

	fmt.Println(stu.Name)
	fmt.Printf("stu地址2：%p\n", &stu)
}
